﻿Imports LinhKienMayTinh.CommonMethods

Public Class NewsListEdit
    Inherits BasePage

    Protected dsSource As DataSet

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            dsSource = GetNewsList()
            Me.Header.Title = Me.AppSettings("SiteName") & " | " & "Quản lý tin tức"
        Catch ex As Exception
            Server.Transfer("~/Pages/Error.aspx")
        End Try
    End Sub

    Private Sub NewsListEdit_Init(sender As Object, e As System.EventArgs) Handles Me.Init
        Dim master As AdminMasterPage = DirectCast(Me.Page.Master, AdminMasterPage)
        master.CssLinkAdd(ResolveUrl("~/Style/NewsListEdit.css"))
    End Sub

#Region "Khai báo các function method"

    Private Function GetNewsList() As DataSet

        Dim xSql As String
        Dim ds As DataSet
        Dim dataAccess As DBAccess

        Try
            dataAccess = Me.GetDBAccess()

            xSql = ""
            xSql = xSql & vbCrLf & "SELECT"
            xSql = xSql & vbCrLf & "		T_NEWS.CODE,"
            xSql = xSql & vbCrLf & "		T_NEWS.NAME        AS TITLE,"
            xSql = xSql & vbCrLf & "		T_NEWS.LINK_NAME,"
            xSql = xSql & vbCrLf & "		T_NEWS.IMG_LINK,"
            xSql = xSql & vbCrLf & "		T_NEWS.SUMMARY,"
            xSql = xSql & vbCrLf & "		T_NEWS.CONTENT,"
            xSql = xSql & vbCrLf & "		T_NEWS.TAG,"
            xSql = xSql & vbCrLf & "		T_NEWS.DEL_FLG,"
            xSql = xSql & vbCrLf & "		T_NEWS.AD_DATE,"
            xSql = xSql & vbCrLf & "		T_NEWS.UD_DATE"
            xSql = xSql & vbCrLf & "FROM "
            xSql = xSql & vbCrLf & "        T_NEWS"
            xSql = xSql & vbCrLf & "ORDER BY"
            xSql = xSql & vbCrLf & "        T_NEWS.UD_DATE DESC"

            ds = dataAccess.GetDBDataset(xSql)

            Return ds
        Catch ex As Exception
            Throw ex
        End Try
    End Function

#End Region

    Protected Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
        Response.Redirect("~/Admin/NewsEdit.aspx")
    End Sub
End Class